import { createSelector } from '@ngrx/store';

import { MapState, FoldingState } from '../reducers';
import { getMapState } from './map.selector';
import { Folding } from '../../models';

const getFoldingState = createSelector(getMapState, (state: MapState) => state.folding);
const getFoldingBasemaps = createSelector(getFoldingState, (state: FoldingState) => state.basemaps);
const getFoldingLayers = createSelector(getFoldingState, (state: FoldingState) => state.layers);
const getFoldingGrid = createSelector(getFoldingState, (state: FoldingState) => state.grid);
const getFoldingMeasure = createSelector(getFoldingState, (state: FoldingState) => state.measure);
const getFoldingResourceTree = createSelector(getFoldingState, (state: FoldingState) => state.resourceTree);
const getFoldingSpaticlFiltering = createSelector(getFoldingState, (state: FoldingState) => state.spaticlFiltering);
const getFoldingUpload = createSelector(getFoldingState, (state: FoldingState) => state.upload);

export const foldingSelector = {
    getFoldingState,
    getFoldingBasemaps,
    getFoldingLayers,
    getFoldingGrid,
    getFoldingMeasure,
    getFoldingResourceTree,
    getFoldingSpaticlFiltering,
    getFoldingUpload
};
